package com.turing.post.common.util;

import java.math.BigInteger;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

/**
 * @用户角色对应表
 * @author zxp
 * @date 2012-12-14
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "SysOpUserRole")
@IdClass(SysOpUserRole.class)
public class SysOpUserRole implements java.io.Serializable {
	/**
	 * 角色编号
	 */
	private BigInteger roleId;
	/**
	 * 用户编号
	 */
	private BigInteger operId;

	public SysOpUserRole() {

	}

	@Id
	@Column(name = "RoleId", nullable = false)
	public BigInteger getRoleId() {
		return roleId;
	}

	public void setRoleId(BigInteger roleId) {
		this.roleId = roleId;
	}

	@Id
	@Column(name = "operId", nullable = false)
	public BigInteger getOperId() {
		return operId;
	}

	public void setOperId(BigInteger operId) {
		this.operId = operId;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((getOperId() == null) ? 0 : getOperId().hashCode());
		result = prime * result
				+ ((getRoleId() == null) ? 0 : getRoleId().hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final SysOpUserRole other = (SysOpUserRole) obj;
		if (getOperId() == null) {
			if (other.getOperId() != null)
				return false;
		} else if (!getOperId().equals(other.getOperId()))
			return false;
		if (getRoleId() == null) {
			if (other.getRoleId() != null)
				return false;
		} else if (!getRoleId().equals(other.getRoleId()))
			return false;
		return true;
	}

}